package com.design.model;

/**
 * def
 *
 * @author lw
 * @date 2023/12/4 17:04
 **/
public class AreaCalculator implements ShapeVisitor{

    private double area;

    @Override
    public void visit(Circle circle) {
        area += Math.PI * circle.getRadius() * circle.getRadius();
    }

    @Override
    public void visit(Rectangle rectangle) {
        area += rectangle.getWidth() * rectangle.getHeight();
    }

    public double getArea() {
        return area;
    }
}
